﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.TcCommands.TcReplace.CUiClassificationSearchWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using ActiveWorkspaceHosting;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Markup;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.TcCommands.TcReplace;

public class CUiClassificationSearchWindow : TxWindow, IComponentConnector
{
  private CCoTcReplaceBaseCmd _cmd;
  internal Grid m_grid;
  internal TxClassificationSearch m_hostControl;
  private bool _contentLoaded;

  public CUiClassificationSearchWindow(CCoTcReplaceBaseCmd cmd)
  {
    this._cmd = cmd;
    this.InitializeComponent();
    this.m_hostControl.Initialize();
  }

  public string SelectedObjectExternalId { get; set; }

  private void m_hostControl_LoadingMultipleObjectsRequested(
    object sender,
    TxClassificationSearch_LoadingMultipleObjectsRequestedEventArgs e)
  {
    if (e.ExternalIds.Count == 1)
    {
      this.SelectedObjectExternalId = e.ExternalIds[0];
      ((Window) this).DialogResult = new bool?(true);
      ((Window) this).Close();
    }
    else
    {
      if (e.ExternalIds.Count <= 1)
        return;
      int num = (int) TxMessageBox.ShowModal(StringTable.RESOURCE_SEARCH_MULTIPLE_RESOURCES_SELECTED_ERROR, this._cmd.Name, MessageBoxButtons.OK, MessageBoxIcon.Hand);
    }
  }

  private void TxWindow_Closing(object sender, CancelEventArgs e)
  {
    this.m_hostControl.Uninitialize();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    System.Windows.Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/tccommands/tcreplace/cuiclassificationsearchwindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        ((Window) target).Closing += new CancelEventHandler(this.TxWindow_Closing);
        break;
      case 2:
        this.m_grid = (Grid) target;
        break;
      case 3:
        this.m_hostControl = (TxClassificationSearch) target;
        this.m_hostControl.LoadingMultipleObjectsRequested += new EventHandler<TxClassificationSearch_LoadingMultipleObjectsRequestedEventArgs>(this.m_hostControl_LoadingMultipleObjectsRequested);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
